<?php
// namespace demo;
/**
 *
 * @authors  Ysg (y.shi.guo@gmail.com)
 * @website  http://ysg.bonza.cn
 * @date     2017-07-24 11:43:02
 */

header("Content-type:text/html;charset:utf8;");
header("Pragma: no-cache");
header("Pragma: no-cache");

date_default_timezone_set('PRC');

define("ROOT_PATH",realpath('.'));


/*$string = 'google 123, 456';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = 'runoob ${2},${3}';
echo preg_replace($pattern, $replacement, $string);*/

/*$str = 'ru	no o   b';
$str = preg_replace('/\s+/', '', $str);
// $str = str_replace(' ','',$str);
// 将会改变为'runoob'
echo $str;
*/

$string = 'The quick brown fox jumped over the lazy dog.';
$patterns = array();
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements = array();
$replacements[0] = 'slow';
$replacements[1] = 'black';
$replacements[2] = 'bear';
echo preg_replace($patterns, $replacements, $string);

// 将文本中的年份增加一年.
$text = "April fools day is 04/01/2002\n";
$text.= "Last christmas was 12/24/2001\n";
echo preg_replace_callback("|(\d{2}/\d{2}/)(\d{4})|",
	function ($mat){
		return $mat[1].($mat[2]+1);
	},
	 $text);






















?>
<!-- <script>
var str = "lsdflksd_--f23423@2yadf.com";
var patt1 = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
var patt1 =^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$;
document.write(str.match(patt1));
</script> -->
